home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE05 / PERFORM / UNIT2.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-05-05  |  1.1 KB  |  53 lines

  1. unit Unit2;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls;
  8.  
  9. type
  10.   TViewerForm = class(TForm)
  11.     Panel1: TPanel;
  12.     FontButton: TSpeedButton;
  13.     FontDialog1: TFontDialog;
  14.     PrintButton: TSpeedButton;
  15.     PrintDialog1: TPrintDialog;
  16.     Memo1: TMemo;
  17.     procedure FontButtonClick(Sender: TObject);
  18.     procedure PrintButtonClick(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. var
  26.   ViewerForm: TViewerForm;
  27.  
  28. implementation
  29. Uses UnitPerf, Printers;
  30.  
  31. {$R *.DFM}
  32.  
  33. procedure TViewerForm.FontButtonClick(Sender: TObject);
  34. begin
  35.   if FontDialog1.Execute then Memo1.Font := FontDialog1.Font
  36. end;
  37.  
  38. procedure TViewerForm.PrintButtonClick(Sender: TObject);
  39. var PrintFile: System.Text;
  40.     i: Integer;
  41. begin
  42.   if PrintDialog1.Execute then
  43.   begin
  44.     AssignPrn(PrintFile);
  45.     Rewrite(PrintFile);
  46.     for i:=0 to Memo1.Lines.Count-1 do writeln(PrintFile,Memo1.Lines[i]);
  47.     System.Close(PrintFile)
  48.   end
  49. end;
  50.  
  51. end.
  52.  
  53.